package com.phone580.app.hotgame;

import android.os.Bundle;
import android.webkit.WebView;

import com.phone580.app.BaseActivity;
import com.phone580.app.CommonData;
import com.phone580.app.JavascriptProxy;
import com.phone580.app.R;

public class HotGameActivity extends BaseActivity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		setType(GAME);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.hot_game_layout);
		web = (WebView) findViewById(R.id.hot_game_web);
		web.getSettings().setJavaScriptEnabled(true);
		web.addJavascriptInterface(new JavascriptProxy(this), "proxy");
//		web.loadUrl("file:///android_asset/bak2/" + "list.html?appType=GAME");
//		web.loadUrl("file:///mnt/sdcard/bak2/" + "list.html?appType=GAME");
		web.loadUrl(CommonData.DATA_PATH + "list.html?appType=GAME");
		initHeader();
	}
	
	@Override
	protected void onStart() {
		super.onStart();
		userLogonOrLogout();
	}
	
	@Override
	public void onBackPressed() {
		String url = web.getUrl();
		if (url.contains("list.html") && url.contains("typeName")) {
			web.goBack();
		} else {
			pressAgainExit();
		}
	}
}
